package secu;

import java.security.Provider;
import java.security.Security;
import java.util.function.Consumer;
import java.util.stream.IntStream;

/**
 * 安全包基础使用
 * @author ben
 * @date 2021-09-26 20:57:57 CST
 */
public class TestSecurity {

	public static Consumer<Object> cs = System.out::println;

	public static void main(String[] args) {
		test1();
	}

	/**
	 * 输出所有安全提供商Provider
	 * @author ben
	 * @date 2021-09-26 20:58:59 CST
	 */
	public static void test1() {
		Provider[] pds = Security.getProviders();
		cs.accept("provider size=" + pds.length + "\n------");
		IntStream.range(0, pds.length).forEach(cnt->{
			Provider pd = pds[cnt];
			cs.accept(cnt + ".pd=" + pd);
			cs.accept(cnt + ".pd=" + pd.getName());
			cs.accept(cnt + ".pd=" + pd.getInfo());
			cs.accept(cnt + ".pd=" + pd.getVersion());
			cs.accept(cnt + ".pd.keySet().size=" + pd.keySet().size());
			cs.accept(cnt + ".pd.keySet()=" + pd.keySet());
			cs.accept("");
			
		});
	}
	
}
